package com.hyt.it.ogt.ks.service;

import java.math.BigDecimal;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hyt.it.ogt.ks.api.kw.model.ObjectiveItemScoreDTO;
import com.hyt.it.ogt.ks.api.kw.model.QuestionAnalysisDTO;
import com.hyt.it.ogt.ks.api.kw.model.QuestionAnalysisRequestDTO;
import com.hyt.it.ogt.ks.feign.model.SubjectiveAnswerVO;
import com.hyt.it.ogt.ks.model.dto.CandidateAnswerSimpleVO;
import com.hyt.it.ogt.ks.model.dto.VerifyAnswerOptionsDTO;
import com.hyt.it.ogt.ks.model.entity.CandidateAnswer;
import com.hyt.it.ogt.ks.model.vo.CandidateFinishExamVO;
import com.hyt.it.ogt.ks.model.vo.CandidateQusAnsVO;
import com.hyt.it.ogt.ks.model.vo.ExamCandidateDetailInfoForScoreVO;
import com.hyt.it.ogt.ks.model.vo.FinishVO;
import com.hyt.it.ogt.ks.model.vo.PaperTopicItemListVO;
import com.hyt.it.ogt.ks.model.xyvo.DayiAssessResultVO;
import com.hyt.it.ogt.ks.model.xyvo.XyCandidateReportVO;
import com.hyt.it.ogt.ks.model.xyvo.XyEvalResultVO;

/**
 * <p>
 * 考试答案详情表 服务类
 * </p>
 *
 * @author chengxh
 * @since 2020-06-17
 */
public interface ICandidateAnswerService extends IService<CandidateAnswer> {

    /**
     * 保存考生答案
     * @param answer 参数
     * @param verify
     */
    PaperTopicItemListVO saveQuestion(CandidateQusAnsVO answer, VerifyAnswerOptionsDTO verify, HttpServletRequest request);

    /**
     * 标记题目
     * @param examId
     * @param candidateId
     * @param itemId
     * @param flagState
     * @return
     */
    int updateState(String examId, String candidateId,String itemId, Integer flagState);

    /**
     * 考生交卷接口（同时保存未提交的答案）
     * @param param 参数
     */
    FinishVO finishExam(CandidateFinishExamVO param, HttpServletRequest request);

    /**
     * 获取主观题答案
     * @param examId
     * @param isBackup
     * @return
     */
    List<SubjectiveAnswerVO> getSubjectiveAnswerByExam(String examId, String admissionNumber, Integer isBackup);

    /**
     * 查询成绩
     * @param examId
     * @param admissionNumber
     * @return
     */
    List<CandidateAnswer> selectAnswerList(String examId, String admissionNumber);

    /**
     * 统分
     * @param param
     */
    void calcObjectiveScore(CandidateFinishExamVO param, boolean forceFinishExam);

    /**
     * 获取测评结果
     * @param examId
     * @param candidateId
     * @param paperId
     * @param paperVersion
     * @return
     */
    XyEvalResultVO getXyEvalResult(String examId, String candidateId, String paperId, String paperVersion, List<ExamCandidateDetailInfoForScoreVO> examCandidateDetailInfos);

    /**
     * 是否获取到测评报告
     * @param examId
     * @param candidateId
     * @return
     */
    Boolean isGetEvalReport(String examId, String candidateId);
    
    /**
     * 推送成绩到大易
     * @return
     */
    DayiAssessResultVO sendScoreToDayi(String examId, String candidateId, String admissionNumber, BigDecimal totalScore, List<ExamCandidateDetailInfoForScoreVO> examCandidateDetailInfos);

    /**
     * 判断性格测试卷类型
     * @param examId
     * @param candidateId
     * @param paperId
     * @param paperVersion
     * @return 0-校招测试，1-社招测试
     */
    Integer getEvalPaperType(String examId, String candidateId, String paperId, String paperVersion);
    
    /**
     * 获取性格测试维度得分
     * @param xyEvalResult
     * @return
     */
    XyCandidateReportVO getXyCandidateReport(XyEvalResultVO xyEvalResult);
    
    /**
     * 获取面试地址
     * @param examId
     * @param candidateId
     * @param supplierType
     * @param modeId
     * @return
     */
    String getInterviewUrl(String examId, String candidateId, String supplierType, String modeId);

    /**
     * 获取考生客观题分数明细
     * @param examId
     * @param candidateId
     * @return
     */
    List<ObjectiveItemScoreDTO> getObjectiveItemScore(String examId, String candidateId, String paperId, String paperVersion);

    /**
     * 验证保存答案时参数+ 题型与答案是否匹配
     * @param answer
     * @return
     */
    VerifyAnswerOptionsDTO verifyAnswerOptions(CandidateQusAnsVO answer);

    /**
     * 当上传的考生答案 与 主观题 不匹配时保存操作轨迹
     * @param ans
     */
    void insertSaveQuestionLog(CandidateQusAnsVO ans);

    List<QuestionAnalysisDTO> getQuestionAnalysis(QuestionAnalysisRequestDTO questionAnalysis);


    List<CandidateAnswerSimpleVO> selectSimpleAnswerList(String examId, List<String> candidateIds, List<Integer> maxScoreVers);

}
